<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/register.css"/>
	</head>
	<body>
		<header>

		</header>

		<section>
		<div class="register-container">
		        <div class="register-wrapper">
		            <div class="clearfix">
		                <h3>注册会员</h3>
		                <p class="tip">
		                    <span>我已经注册，现在就 </span>
		                    <a href="login1.html">登录</a>
		                </p>
		            </div>
		            <div class="register-form">
		                <div class="reg_form">
		                    <div class="text-item phone-item">
		                        <label>
		                            <i class="required">*</i>手机号码：
		                        </label>
		                        <input type="text" class="phone" placeholder="请输入11位数字的手机号码">
		                       <span class="error-tips"></span>
		                    </div>
		                    <div class="imgcheck-item">
		                        <label>
		                            <i class="required">*</i>验证码：
		                        </label>
		                        <div class="imgcheck-ctrl">
		                            <input type="text" class="code" placeholder="请输入右图中的字符（不区分大小写）">
		                            <div class="imgbtn">
		                                <img src="img/imgs/ValidateCode.png" class="imgcheck">
		                                <span>看不清？</span>
		                                <a href="javascript:;" id="changecode" class="imgchange">换一张</a>
		                            </div>
		                        </div>
		                       <span class="error-tips"></span>
		                    </div>
		                    <div class="sms-item">
		                        <label>
		                            <i class="required">*</i>短信验证码：
		                        </label>
		                        <div class="sms-ctrl">
		                            <input type="text" class="phonecode" placeholder="请输入手机收到的验证码">
		                            <button type="button" class="getphonecode">获取手机验证码</button>
		                        </div>
		                        <span class="error-tips"></span>
		                    </div>
		                    <div class="text-item pwd-item">
		                        <label>
		                            <i class="required">*</i>请设置密码：
		                        </label>
		                        <input type="password" class="pwd" placeholder="6-16个字符（数字、字母、符号至少包括两种）">
		                       <span class="error-tips"></span>
		                    </div>
		                    <div class="text-item pwd-item">
		                        <label>
		                            <i class="required">*</i>请确认密码：
		                        </label>
		                        <input type="password" class="repwd" placeholder="请再次输入密码">
		                       <span class="error-tips"></span>
		                    </div>
		                    <div class="agree-item">
		                        <input id="agreebtn" class="agreebtn" type="checkbox">
		                      <!-- <label for="agreebtn" class="agree-check"></label> -->
		                        <span>我已阅读并同意</span>
		                        <a href="#;" class="agreement">《飞亚达用户注册协议》</a>
		                    </div>
		
		                    <div class="submit-item">
		                        <button type="button" class="btn">立即注册</button>
		                    </div>
		                </div>
		            </div>
		        </div>
		    </div>
		</section>
		<footer>

		</footer>
		<aside>
			
		</aside>
	</body>
</html>
<script src="js/jQuery.js"></script>
<script src="js/register.js" type="text/javascript" charset="utf-8"></script>
<!-- <script type="text/javascript">
    $(function(){
        $(".btn").on("click",function(){
            var userName = $(".phone").val();
            var pwd = $(".pwd").val();
            var rePwd = $(".repwd").val();
            if(userName==""||pwd==""||rePwd==""){
                alert("所有信息不可为空，请确认！");
                return;
            }else if(pwd!=rePwd){
                alert("两次密码输入不一致！");
                return;
            }
       
            $.post("js/register.php",{
                "userName":$(".phone").val(),
                "pwd":$(".pwd").val()
            },function(date){
                if(date==0){
					alert("注册成功");
                    location.href = "login1.html";
                }else if(date==1){
					alert("已被注册");
					location = "register.html";
				}
            })
            
        });
    });
</script>

<script type="text/javascript">
	
	function fun(resText){
		let oSpan = document.querySelector(".error-tips");
		
		oSpan.innerHTML = resText;
	}
	// var oPhone=document.querySelector(".phone");
	var oF = document.querySelector(".register-form");
	var oPwd=document.querySelector(".pwd")
	var oSpan = document.querySelectorAll(".error-tips");
	var regphone = /^1(3|5|6|8|7)\d{9}$/;
	var regPwd = /^.{6,13}$/;
	var flagon = false;
	$(".phone").blur(function(){
		if(regphone.test(this.value)){
			$.post("js/ajax.php",
				{"userName":$(".phone").val()},
				function(resText){
					console.log(resText);
					if(resText=="no"){
						oSpan[0].innerHTML ="已被注册";
					}
					else if(resText=="yes"){
						oSpan[0].innerHTML ="可以注册";
					}
				})
		}else{
			flagon = false;
			oSpan[0].innerHTML = "输入不合法";
			
		}
	})
	oPwd.onblur = function(){
		if(regPwd.test(this.value)){
			flagon = true;
			oSpan[3].innerHTML = "";
		}else{
			flagon = false;
			oSpan[3].innerHTML = "输入不合法";
		}
	}
	oF.onsubmit = function(){
		if(oPhone && oPwd){
			return true;
		}else{
			return false;
		}
	}
	
</script> -->

<script>
	$("header").load("header.html");
</script>
<script>
	$("footer").load("footer.html");
</script>
<script >
	$("aside").load("sidebar.html");
</script>

